    <div class="refentry" id="glGetProgramResourceLocation">
      <div class="titlepage"></div>
      <div class="refnamediv">
        <h2>Name</h2>
        <p>glGetProgramResourceLocation — query the location of a named resource within a program</p>
      </div>
      <div class="refsynopsisdiv">
        <h2>C Specification</h2>
        <div class="funcsynopsis">
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">GLint <strong class="fsfunc">glGetProgramResourceLocation</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">program</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLenum <var class="pdparam">programInterface</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>const char * <var class="pdparam">name</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
        </div>
      </div>
      <div class="refsect1" id="parameters">
        <h2>Parameters</h2>
        <div class="variablelist">
          <dl class="variablelist">
            <dt>
              <span class="term">
                <em class="parameter">
                  <code>program</code>
                </em>
              </span>
            </dt>
            <dd>
              <p>
                    The name of a program object whose resources to query.
                </p>
            </dd>
            <dt>
              <span class="term">
                <em class="parameter">
                  <code>programInterface</code>
                </em>
              </span>
            </dt>
            <dd>
              <p>
                    A token identifying the interface within <em class="parameter"><code>program</code></em> containing the resource named <em class="parameter"><code>name</code></em>.
                </p>
            </dd>
            <dt>
              <span class="term">
                <em class="parameter">
                  <code>name</code>
                </em>
              </span>
            </dt>
            <dd>
              <p>
                    The name of the resource to query the location of.
                </p>
            </dd>
          </dl>
        </div>
      </div>
      <div class="refsect1" id="description">
        <h2>Description</h2>
        <p>
            <code class="function">glGetProgramResourceLocation</code> returns the location assigned
            to the variable named <em class="parameter"><code>name</code></em> in interface <em class="parameter"><code>programInterface</code></em> of program
            object <em class="parameter"><code>program</code></em>.  <em class="parameter"><code>program</code></em> must be the name of a program that has been
            linked successfully. <em class="parameter"><code>programInterface</code></em> must
            be one of <code class="constant">GL_UNIFORM</code>, <code class="constant">GL_PROGRAM_INPUT</code>, <code class="constant">GL_PROGRAM_OUTPUT</code>,
            or <code class="constant">GL_TRANSFORM_FEEDBACK_BUFFER</code>.
       </p>
        <p>
            The value -1 will be returned if an error occurs, if <em class="parameter"><code>name</code></em> does not identify an active variable on
            <em class="parameter"><code>programInterface</code></em>, or if <em class="parameter"><code>name</code></em> identifies an active variable that does
            not have a valid location assigned, as described above.  The locations
            returned by these commands are the same locations returned when querying
            the <code class="constant">GL_LOCATION</code> and <code class="constant">GL_LOCATION_INDEX</code> resource properties.
        </p>
        <p>
            A string provided to <code class="function">glGetProgramResourceLocation</code> is considered to match an active variable if:
        </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>
                    the string exactly matches the name of the active variable
                </p>
            </li>
            <li class="listitem">
              <p>
                    if the string identifies the base name of an active array, where the
                    string would exactly match the name of the variable if the suffix
                    "[0]" were appended to the string
                </p>
            </li>
            <li class="listitem">
              <p>
                    if the string identifies an active element of the array, where the
                    string ends with the concatenation of the "[" character, an integer
                    <span class="emphasis"><em>with no "+" sign, extra leading zeroes, or whitespace</em></span> identifying an
                    array element, and the "]" character, the integer is less than the
                    number of active elements of the array variable, and where the string
                    would exactly match the enumerated name of the array if the decimal
                    integer were replaced with zero.
                </p>
            </li>
          </ul>
        </div>
        <p>
            Any other string is considered not to identify an active variable.  If the
            string specifies an element of an array variable,
            <code class="function">glGetProgramResourceLocation</code> returns the
            location assigned to that element.  If it
            specifies the base name of an array, it identifies the resources
            associated with the first element of the array.
        </p>
      </div>
      <div class="refsect1" id="errors">
        <h2>Errors</h2>
        <p>
            <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>program</code></em>
            is not the name of an existing program object.
        </p>
        <p>
            <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>programInterface</code></em>
            is not one of the accepted interface types.
        </p>
        <p>
            <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>program</code></em>
            has not been linked successfully.
        </p>
      </div>
      {$pipelinestall}{$examples}
      <div class="refsect1" id="versions">
        <h2>API Version Support</h2>
        <div class="informaltable">
          <table style="border-collapse: collapse; border-top: 2px solid ; border-bottom: 2px solid ; border-left: 2px solid ; border-right: 2px solid ; ">
            <colgroup>
              <col style="text-align: left; "/>
              <col style="text-align: center; " class="firstvers"/>
              <col style="text-align: center; "/>
              <col style="text-align: center; " class="lastvers"/>
            </colgroup>
            <thead>
              <tr>
                <th style="text-align: left; border-right: 2px solid ; ">

            </th>
                <th style="text-align: center; border-bottom: 2px solid ; " colspan="3">
                <span class="bold"><strong>OpenGL ES API Version</strong></span>
            </th>
              </tr>
              <tr>
                <th style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>Function Name</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>2.0</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>3.0</strong></span>
            </th>
                <th style="text-align: center; border-bottom: 2px solid ; ">
                <span class="bold"><strong>3.1</strong></span>
            </th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; ">
                  <code class="function">glGetProgramResourceLocation</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; ">-</td>
                <td style="text-align: center; border-right: 2px solid ; ">-</td>
                <td style="text-align: center; ">✔</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <div class="refsect1" id="seealso">
        <h2>See Also</h2>
        <p>
            <a class="citerefentry" href="glGetProgramResourceName"><span class="citerefentry"><span class="refentrytitle">glGetProgramResourceName</span></span></a>,
            <a class="citerefentry" href="glGetProgramResourceIndex"><span class="citerefentry"><span class="refentrytitle">glGetProgramResourceIndex</span></span></a>,
            <a class="citerefentry" href="glGetGetProgramResource"><span class="citerefentry"><span class="refentrytitle">glGetGetProgramResource</span></span></a>,
            <a class="citerefentry" href="glGetProgramResourceIndex"><span class="citerefentry"><span class="refentrytitle">glGetProgramResourceIndex</span></span></a>.
        </p>
      </div>
      <div class="refsect1" id="Copyright">
        <h2>Copyright</h2>
        <p>
            Copyright © 2012-2014 Khronos Group.
            This material may be distributed subject to the terms and conditions set forth in
            the Open Publication License, v 1.0, 8 June 1999.
            <a class="link" href="https://opencontent.org/openpub/" target="_top">https://opencontent.org/openpub/</a>.
        </p>
      </div>
    </div>
